/**
 * 
 */
package cn.com.gxetc.assistant.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import cn.com.gxetc.assistant.utils.JwtUtils;
import me.chanjar.weixin.cp.api.WxCpService;

/**
 * @author yfm
 *
 */
@Configuration
public class WebAppConfig extends WebMvcConfigurerAdapter {
	@Autowired
	WxCpService wxCpService;

	@Autowired
	JwtUtils jwtUtils;

	/**
	 * 配置拦截器
	 * 
	 * @author yfm
	 * @param registry
	 */
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(newSecurityInterceptor()).addPathPatterns("/*").excludePathPatterns("/auth*");
	}

	@Bean
	SecurityInterceptor newSecurityInterceptor() {
		return new SecurityInterceptor(wxCpService, jwtUtils);

	}

}
